/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package optimization;

import queryTree.SimpleBoolExpr;

/**
 *
 * @author yulian
 */
public class Field {

    public Field() {
        this.table_name = tab_name_att_name.NULL;
        this.item_name = tab_name_att_name.NULL;
    }

    public Field(tab_name_att_name s, tab_name_att_name i) {
        this.table_name = s;
        this.item_name = i;
    }

    public Field(tab_name_att_name s) {
        this.table_name = s;
        this.item_name = tab_name_att_name.NULL;
    }
    public tab_name_att_name table_name;
    public tab_name_att_name item_name;
    
    //Van: for comparision purpose
    public int hashCode() {
		return table_name.hashCode() + item_name.hashCode();
	}
    
    //Van: for comparision purpose
    public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o instanceof Field) {
			Field other = (Field) o;			
			if(item_name == tab_name_att_name.NULL || other.item_name == tab_name_att_name.NULL) {
				return table_name.toString().equals(other.table_name.toString());
			} else {
				return table_name.toString().equals(other.table_name.toString())
			 	&& item_name.toString().equals(other.item_name.toString());
			}
			
		}
		return false;
	}
}
